package com.msy.mai.module.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msy.mai.module.system.convert.SysUserConvert;
import com.msy.mai.module.system.entity.domain.SysUser;
import com.msy.mai.module.system.entity.vo.SysUserVo;
import com.msy.mai.module.system.mapper.SysUserMapper;
import com.msy.mai.module.system.service.SysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
* @author Wang
* @description 针对表【sys_user(用户信息表)】的数据库操作Service实现
* @createDate 2024-10-27 19:20:41
*/
@Service
@RequiredArgsConstructor
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService {

    private final SysUserMapper sysUserMapper;

    @Override
    public SysUserVo loadUserVoByUsername(String username) {
        SysUser sysUser = sysUserMapper.selectOne(
                new LambdaQueryWrapper<SysUser>()
                        .eq(SysUser::getUsername, username)
        );

        return sysUser == null ? null : SysUserConvert.MAPPER.to(sysUser);
    }
}




